#!/bin/bash

# This file is part of Equaked.

# Equaked is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# any later version.

# Equaked is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with Foobar; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
station1=_STATION1_
station2=_STATION2_
station3=_STATION3_

supervisor="./supervisor2"
preprocess="./preprocess"

#collect data from each E-Puck
$supervisor $station1 $station2 $station3

#preprocess files
$preprocess $station1
$preprocess $station2
$preprocess $station3

#preprocess matlab file
sed -e "s/#STATION1#/$station1/g" -e "s/#STATION2#/$station2/g" -e "s/#STATION3#/$station3/g" compute_tdoa-TEMPLATE.m > compute_tdoa.m

#launch matlab scripts
echo "Launching matlab ..."
exec matlab -nojvm -nosplash -r plot_multilateration

